import 'package:base_flutter/base_flutter.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:ls_work/net/post_request.dart';
import 'package:ls_work/net/response/response_data.dart';
import 'package:ls_work/net/response/service_item_content_list.dart';

class ServiceItemContentViewModel extends BaseListViewModel<ServiceItemContentList>{
  final String typeId;

  ServiceItemContentViewModel(BuildContext context,this.typeId) : super(context);

  @override
  Future<List<ServiceItemContentList>> requestListData() async {
    var data = await PostRequest.serviceItemContent(typeId, page, pageLength);
    var bean = ResponseData.fromJson(data,listBuilder: (i)=>ServiceItemContentList.fromJson(i));
    if("0"==bean.code){
      return bean.data?.rows??[];
    }else{
      throw bean.msg??"";
    }
  }

  @override
  void onCreated() {
    super.onCreated();
    requestRefresh();
  }



}